Отключения настройки
"Reverse rewrite host in response headers"

Возможны случаи, когда веб приложение будет формировать html страницы, содержащие некорректные ссылки. Например ссылающиеся не на адрес прокси, а на внутренний адрес приложения.
Потребуется, что прокси модифицировал исходящие страницы, переписывая содержимое на основе некоторых правил.

IIS reverse proxy with rewrites can't handle a redirect from the server we proxy to
https://stackoverflow.com/questions/4243959/iis-reverse-proxy-with-rewrites-cant-handle-a-redirect-from-the-server-we-proxy

Переписывание заголовков во входящих запросах для отключения сжатия в ответах сервера приложения.
(Например gzip)

У IIS могут возникнуть проблем с изменением содержимого страницы, если ответ от сервера приложения возвращается в сжатом виде.

IIS as a reverse proxy - compression of rewritten response from backend server
https://stackoverflow.com/questions/15926203/iis-as-a-reverse-proxy-compression-of-rewritten-response-from-backend-server

The server variable is not allowed to be set.
http://www.sansys.net/2015/01/server-variable-is-not-allowed-to-be-set.html

Замечание: заголовок с указанием сжатия для html контента, и для ответа от web api могут быть разными.

Переписывание редирект ссылок в хедерах ответов от севера приложенияModifying HTTP Response Headers
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/modifying-http-response-headers
Переписывание ссылок в html страницах, json ответах web api и другом контенте.

How to fix URL Rewriting for links inside CSS files with IIS7
https://stackoverflow.com/questions/8653399/how-to-fix-url-rewriting-for-links-inside-css-files-with-iis7

Замечание: паттерн сопоставления в html страницах и json документах могут различаться в следствии наличия/отсутствия/различии в экранировании символов.

<outboundRules>
<preConditions>
 <preCondition name="IsRedirection">
  <add input="{RESPONSE_STATUS}" pattern="3\d\d" ></add>
 </preCondition>
 <preCondition name="ResponseIsHtml">
  <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" ></add>
 </preCondition>
 <preCondition name="ResponseIsJson">
  <add input="{RESPONSE_CONTENT_TYPE}" pattern="^application/json" ></add>
 </preCondition>
</preConditions>
<rule name="Rewrite Location Header" preCondition="IsRedirection" stopProcessing="true">
 <match serverVariable="RESPONSE_Location" pattern="http://ResponseUrl(.*)" ></match>
 <action type="Rewrite" value="https://ProxyUrl{R:1}" ></action>
</rule>
<rule name="Rewrite static content" preCondition="ResponseIsHtml" stopProcessing="true">
 <match filterByTags="None" pattern="http://ResponseUrl" ></match>
 <action type="Rewrite" value="https://ProxyUrl" ></action>
</rule>
<rule name="Rewrite api content" preCondition="ResponseIsJson" stopProcessing="true">
 <match filterByTags="None" pattern="http:\\/\\/ResponseUrl" ></match>
 <action type="Rewrite" value="https://ProxyUrl" ></action>
</rule>
</outboundRules>
  
  
Теги: